#!/usr/bin/env php
<?php
/**
 * @author    jan huang <bboyjanhuang@gmail.com>
 * @copyright 2016
 *
 * @see      https://www.github.com/janhuang
 * @see      http://www.fast-d.cn/
 */

use FastD\Migration\Migrate;
use Symfony\Component\Console\Application;

set_time_limit(0);
date_default_timezone_set('PRC');

// autoload composer
foreach ([
             __DIR__ . '/../../autoload.php',
             __DIR__ . '/../vendor/autoload.php',
             __DIR__ . '/vendor/autoload.php'
         ] as $value) {
    if (file_exists($value)) {
        define('COMPOSER_INSTALL', $value);
        break;
    }
}

if (!defined('COMPOSER_INSTALL')) {
    fwrite(STDERR,
        'You need to set up the project dependencies using the following commands:' . PHP_EOL .
        'wget http://getcomposer.org/composer.phar' . PHP_EOL .
        'php composer.phar install' . PHP_EOL
    );
}

include COMPOSER_INSTALL;

$migrator = new \FastD\Migration\Migrator();

$migrator->run();